'use strict';

module.exports = app => {
  const { STRING, UUID, UUIDV4, DECIMAL, INTEGER } = app.Sequelize;

  const model = app.model.define('repair', {
    id: {
      type: UUID,
      primaryKey: true,
      defaultValue: UUIDV4,
      comment: '主键',
    },
    create_userid: {
      type: STRING,
      allowNull: false,
      comment: '创建人用户Id',
    },
    create_username: {
      type: STRING,
      allowNull: false,
      comment: '创建人用户名',
    },
    content: {
      type: STRING,
      comment: '报修详情',
    },
    type: {
      type: STRING,
      comment: '故障类型',
    },
    status: {
      type: STRING,
      comment: '状态',
    },
    device_name: {
      type: STRING,
      comment: '设备名称',
    },
    device_name: {
      type: STRING,
      comment: '设备名称',
    },
    device_type: {
      type: STRING,
      comment: '设备型号',
    },
    customer_name: {
      type: STRING,
      comment: '客户名称',
    },
    customer_address: {
      type: STRING,
      comment: '客户地址',
    },
    customer_tel: {
      type: STRING,
      comment: '客户联系方式',
    },
    is_expired: {
      type: UUID,
      comment: '是否过保',
    },
    amount: {
      type: DECIMAL,
      comment: '预计收费金额',
    },
    fact_amount: {
      type: DECIMAL,
      comment: '实际收费金额',
    },
    do_person_id: {
      type: STRING,
      comment: '处理技术员Id',
    },
    do_person_name: {
      type: STRING,
      comment: '处理技术员名称',
    },
    do_remark: {
      type: STRING,
      comment: '派发备注',
    },
    result: {
      type: UUID,
      comment: '处理结果',
    },
    reason: {
      type: STRING,
      comment: '处理原因',
    },
    eval_score: {
      type: INTEGER,
      comment: '评价满意度',
    },
    eval_content: {
      type: STRING,
      comment: '评价反馈',
    },
    files1: {
      type: STRING(2000),
      comment: '问题报修附件'
    },
    files2: {
      type: STRING(2000),
      comment: '问题处理附件'
    },
  }, {
    tableName: 'repair',
    comment: '报修记录表',
  });

  return model;
};
